package com.xjy.rpc.utils;


import jodd.io.ZipBuilder;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description: TODO 文件上传工具类
 * @author XJY
 * @date 2024/10/22 17:20
 * @version 1.0
 */
public class FileUploadUtils {

    public static final AtomicInteger BACK_ID = new AtomicInteger(0);

    public static String getBackId(){
        if (BACK_ID.get() == Integer.MAX_VALUE){
            BACK_ID.set(0);
        }
        return String.valueOf(BACK_ID.getAndIncrement());
    }

    public static String randomParam(){
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        String param = format.format(date);
        String backId = getBackId();
        return param+backId;
    }


    public static void main(String[] args) throws FileNotFoundException {


    }

}
